home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Copyright (C) 1997-1999 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Nov. 96
- //
- //
- // Description:
- // This script creates a window that can be used to
- // set the locked status of attributes on active objects.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- //
-
- global proc PSupdateLockingUI ( string $parent, string $selectedItem )
- //
- // Setup the two lists of attributes - those that
- // are locked, and those that aren't, so the user
- // can flip them from one side to the other.
- //
- {
- setParent $parent;
-
- int $LOCKED_List_Limit, $NONLOCKED_List_Limit;
- string $LOCKED_List[], $NONLOCKED_List[];
-
- $LOCKED_List = `listAttr -m -l -s -v -r -w -c $selectedItem`;
- $NONLOCKED_List = `listAttr -m -u -s -v -r -w -c $selectedItem`;
- $LOCKED_List_Limit = size( $LOCKED_List );
- $NONLOCKED_List_Limit = size( $NONLOCKED_List );
-
- $LOCKED_List = sort($LOCKED_List);
- $NONLOCKED_List = sort($NONLOCKED_List);
-
- // Since listAttr is going to return the full attribute names
- // we need, strip off any component parts of $selectedItem
- // by tokenizing based on the "." character.
- //
- string $node, $buffer[];
- tokenize( $selectedItem, ".", $buffer );
- if( size( $buffer ) > 0 ) {
- $node = $buffer[0];
- } else {
- $node = $selectedItem;
- }
-
- // First clear, then refill the locked and
- // non-locked scroll lists
- //
-
- textScrollList -e -m 0 LOCKED_List;
- textScrollList -e -m 0 NONLOCKED_List;
-
- textScrollList -e -ra LOCKED_List;
- textScrollList -e -ra NONLOCKED_List;
-
- int $i;
- for ( $i=0; $i < $LOCKED_List_Limit; $i++ )
- {
- textScrollList -e -a $LOCKED_List[$i] LOCKED_List;
- }
-
- for ( $i=0; $i < $NONLOCKED_List_Limit; $i++ )
- {
- int $isLocking;
- string $attrName = ( $node + "." + $NONLOCKED_List[$i] );
-
- if( !catch( $isLocking = `getAttr -l $attrName` )
- &&( $isLocking == 0 ) )
- {
- textScrollList -e -a $NONLOCKED_List[$i] NONLOCKED_List;
- }
- }
-
- textScrollList -e -m 1 LOCKED_List;
- textScrollList -e -m 1 NONLOCKED_List;
-
- // Hook up the buttons to the right object
- //
- button -e
- -c ( "PS_unlockAttributes " + $parent + " " + $selectedItem )
- NONLOCKED_Button;
- button -e
- -c ( "PS_lockAttributes " + $parent + " " + $selectedItem )
- LOCKED_Button;
-
- // Dim the lock and unlock buttons. They will be undimmed when
- // the user clicks on either list
- //
- disable LOCKED_Button;
- disable NONLOCKED_Button;
- }
-
- global proc PS_lockAttributes ( string $parent, string $selectedItem )
- //
- // Move items selected in the non-locked list
- // to the locked list...
- //
- {
- setParent $parent;
-
- int $selectedAttrsSize;
- string $selectedAttrs[];
-
- $selectedAttrs = `textScrollList -q -si NONLOCKED_List`;
- $selectedAttrsSize = size( $selectedAttrs );
-
- // Since listAttr is going to return the full attribute names
- // we need, strip off any component parts of $selectedItem
- // by tokenizing based on the "." character.
- //
- string $node, $buffer[];
- tokenize( $selectedItem, ".", $buffer );
- if( size( $buffer ) > 0 ) {
- $node = $buffer[0];
- } else {
- $node = $selectedItem;
- }
-
- // see if the ALL option is engaged
- //
- int $changeAll = `checkBox -q -v CC_LOCKALL_Box`;
-
- if ( $changeAll ){
- // get the node type of the current node
- //
- string $baseType = `nodeType $selectedItem`;
-
- // get a list of all selected nodes
- //
- string $allNodes[] = `selectedNodes`;
-
- // for each node that matches type, set the locked state
- // of each attribute in the non-locked list
- //
- int $limit = `size($allNodes)`;
- string $thisNode;
- int $index;
- for ( $index=0; $index<$limit; $index++ ){
- $thisNode = $allNodes[$index];
- if ( `nodeType $thisNode` == $baseType ){
- int $i;
- for ( $i=0; $i<$selectedAttrsSize; $i++ ){
- setAttr -l on ( $thisNode + "." + $selectedAttrs[$i] );
- }
- }
- }
- } else { // only change the selected node
-
- int $i;
- for( $i=0; $i < $selectedAttrsSize; $i++ )
- {
- setAttr -l on ( $node + "." + $selectedAttrs[$i] );
- }
- }
-
- // Update the window
- //
- PSupdateLockingUI $parent $selectedItem;
- }
-
-
- global proc PS_unlockAttributes ( string $parent, string $selectedItem )
- //
- // Move items selected in the locked list
- // to the non-locked list...
- //
- {
- setParent $parent;
-
- int $selectedAttrsSize;
- string $selectedAttrs[];
-
- $selectedAttrs = `textScrollList -q -si LOCKED_List`;
- $selectedAttrsSize = size( $selectedAttrs );
-
- // Since listAttr is going to return the full attribute names
- // we need, strip off any component parts of $selectedItem
- // by tokenizing based on the "." character.
- //
- string $node, $buffer[];
- tokenize( $selectedItem, ".", $buffer );
- if( size( $buffer ) > 0 ) {
- $node = $buffer[0];
- } else {
- $node = $selectedItem;
- }
-
- // see if the ALL option is engaged
- //
- int $changeAll = `checkBox -q -v CC_LOCKALL_Box`;
-
- if ( $changeAll ){
- // get the node type of the current node
- //
- string $baseType = `nodeType $selectedItem`;
-
- // get a list of all selected nodes
- //
- string $allNodes[] = `selectedNodes`;
-
- // for each node that matches type, set the locked state
- // of each attribute in the non-locked list
- //
- int $limit = `size($allNodes)`;
- string $thisNode;
- int $index;
- for ( $index=0; $index<$limit; $index++ ){
- $thisNode = $allNodes[$index];
- if ( `nodeType $thisNode` == $baseType ){
- int $i;
- for ( $i=0; $i<$selectedAttrsSize; $i++ ){
- string $pAttr[] = `attributeQuery -lp -n $thisNode $selectedAttrs[$i]`;
- if (size($pAttr) > 0) {
- int $pLock;
- $pLock = `getAttr -l ( $thisNode + "." + $pAttr[0] )`;
- if ($pLock == 1) {
- // If the parent is locked.
- // Unlock the parent and
- // Lock the rest of the children
- //
- setAttr -l off ( $thisNode + "." + $pAttr[0] );
- string $cAttr[] = `attributeQuery -lc -n $thisNode $pAttr[0]`;
- int $cCount = size($cAttr);
- for ( $c=0; $c<$cCount; $c++ ){
- setAttr -l 1 ( $thisNode + "." + $cAttr[$c] );
- }
- }
- }
- setAttr -l off ( $thisNode + "." + $selectedAttrs[$i] );
- }
- }
- }
- } else { // only change the selected node
- int $i;
- for( $i=0; $i < $selectedAttrsSize; $i++ )
- {
- string $pAttr[] = `attributeQuery -lp -n $node $selectedAttrs[$i]`;
- if (size($pAttr) > 0) {
- int $pLock;
- $pLock = `getAttr -l ( $node + "." + $pAttr[0] )`;
- if ($pLock == 1) {
- // If the parent is locked.
- // Unlock the parent and
- // Lock the rest of the children
- //
- setAttr -l off ( $node + "." + $pAttr[0] );
- string $cAttr[] = `attributeQuery -lc -n $node $pAttr[0]`;
- int $cCount = size($cAttr);
- for ( $c=0; $c<$cCount; $c++ ){
- setAttr -l 1 ( $node + "." + $cAttr[$c] );
- }
- }
- }
- setAttr -l off ( $node + "." + $selectedAttrs[$i] );
- }
- }
-
- // Update the window
- //
- PSupdateLockingUI $parent $selectedItem;
- }
-
-
- global proc PScreateLockingUI( string $parent, string $node )
- //
- // Sets up a UI that shows all the DAG and
- // Shape nodes in the system, so that the
- // user can set the locked attributes for
- // them.
- //
- {
- setParent $parent;
-
- string $myContainer = `formLayout containerForm`;
-
- text -l "Locked" LOCKED_Text;
-
- // Label the non-locked area
- //
- text -l "Non Locked" NONLOCKED_Text;
-
- // Create the Move to non-locked button
- //
- string $nkButton = `button -l "Move >>"
- -c ( "PS_unlockAttributes " + $parent + " " + $node )
- -h 26
- NONLOCKED_Button`;
-
- // Create the Move to locked button
- //
- string $kButton = `button -l "<< Move"
- -c ( "PS_lockAttributes " + $parent + " " + $node )
- -h 26
- LOCKED_Button`;
-
- // Create the cancel/close button
- //
- button -l "Close" -h 26 -c "deleteUI LockingKeyable" CLOSE_Button;
-
- // Create the ALL checkbox
- //
- if ( !`optionVar -exists CClockAllSame` ){
- optionVar -intValue CClockAllSame 1;
- }
- checkBox
- -l "Change all selected objects of the same type"
- -v `optionVar -q CClockAllSame`
- -cc "optionVar -intValue CClockAllSame #1"
- CC_LOCKALL_Box;
-
- // Create the locked scroll list
- //
- textScrollList
- -ams 1
- -h 150
- -sc ("disable LOCKED_Button; disable -v false " + $nkButton + ";textScrollList -e -da NONLOCKED_List" )
- LOCKED_List;
-
- // Create the non-locked scroll list
- //
- textScrollList
- -ams 1
- -h 150
- -sc ("disable NONLOCKED_Button; disable -v false " + $kButton + ";textScrollList -e -da LOCKED_List" )
- NONLOCKED_List;
-
- separator -style "in" -hr true LOCKED_Sep;
-
- // Edit the form attachments
- //
-
- formLayout -edit
- -af LOCKED_Text top 10
- -af LOCKED_Text left 10
- -ap LOCKED_Text right 10 50
- -an LOCKED_Text bottom
-
- -af NONLOCKED_Text top 10
- -ap NONLOCKED_Text left 10 50
- -af NONLOCKED_Text right 10
- -an NONLOCKED_Text bottom
-
- -af LOCKED_List top 30
- -af LOCKED_List left 10
- -ap LOCKED_List right 0 50
- -ac LOCKED_List bottom 10 LOCKED_Sep
-
- -af NONLOCKED_List top 30
- -ap NONLOCKED_List left 0 50
- -af NONLOCKED_List right 10
- -ac NONLOCKED_List bottom 10 LOCKED_Sep
-
- -an LOCKED_Sep top
- -af LOCKED_Sep left 0
- -af LOCKED_Sep right 0
- -af LOCKED_Sep bottom 60
-
- -an CC_LOCKALL_Box top
- -af CC_LOCKALL_Box left 15
- -af CC_LOCKALL_Box bottom 35
- -an CC_LOCKALL_Box right
-
- -an CLOSE_Button top
- -ap CLOSE_Button right 2 66
- -ap CLOSE_Button left 2 33
- -af CLOSE_Button bottom 5
-
- -an NONLOCKED_Button top
- -ap NONLOCKED_Button right 2 33
- -af NONLOCKED_Button left 5
- -af NONLOCKED_Button bottom 5
-
- -an LOCKED_Button top
- -ap LOCKED_Button left 2 66
- -af LOCKED_Button right 5
- -af LOCKED_Button bottom 5
-
- $myContainer;
-
-
- // Fill the scroll lists
- // with the selected object's attributes
- //
-
- PSupdateLockingUI $parent $node;
- showWindow;
- }
-